import Vue from 'vue'
import VueRouter from 'vue-router'
import util from "@/libs/util";

Vue.use(VueRouter)

const routes = [
    {
        path: "/",
        name: '_loginPortal',
        redirect: '/home',
        component: () => import(`@/views/index/index.vue`),
        meta: {
            title: "",
            index: 0
        },
        children: [
            {
                path: '/home',
                name: 'misHome',
                component: () => import(`@/views/children-page/home/home.vue`),
                meta: {
                    title: '南京市玄武区教师进修学校'
                },
            },
            {
                path: '/articleDetails',
                name: 'misArticle',
                component: () => import(`@/views/children-page/article-block/article-block.vue`),
                meta: {
                    title: '南京市玄武区教师进修学校',

                },
            },
            {
                path: '/listPage',
                name: 'misList',
                component: () => import('@/views/children-page/list-page/list-page.vue'),
                meta: {
                    title: '南京市玄武区教师进修学校'
                },
            },
            {
                path: '/category',
                name: 'category',
                component: () => import(`@/views/children-page/category-view/category-view.vue`),
                meta: {
                    title: '南京市玄武区教师进修学校'
                },
            },
            {
                path: '/jsfc',
                name: 'jsfc',
                component: () => import(`@/views/children-page/jsfc`),
                meta: {
                    title: '南京市玄武区教师进修学校'
                },
            },
        ]
    },
]

const router = new VueRouter({
    routes
})
router.afterEach((to, form, next) => {

        util.title(to.meta.title)
    })


const originalPush = VueRouter.prototype.push
   VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
export default router
